From 4d6a50d0bec3944b23bbf71e457bc5effc8cd981 Mon Sep 17 00:00:00 2001 From: "vhanquez@kneesa.uk.xensource.com" Date: Wed, 25 Jan 2006 11:51:21 +0000 Subject: [PATCH] Separate the validity checking of the page frame in 2 chunks. give a more accurate error message, and don't call pfn_to_page before validating the pfn. Signed-off-by: Vincent Hanquez --- xen/common/grant_table.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 93312868b2..7576d715d3 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -719,10 +719,18 @@ gnttab_transfer( } /* Check the passed page frame for basic validity. */ + if ( unlikely(!pfn_valid(gop.mfn)) ) + { + DPRINTK("gnttab_transfer: out-of-range %lx\n", + (unsigned long)gop.mfn); + (void)__put_user(GNTST_bad_page, &uop[i].status); + continue; + } + page = pfn_to_page(gop.mfn); - if ( unlikely(!pfn_valid(gop.mfn) || IS_XEN_HEAP_FRAME(page)) ) + if ( unlikely(IS_XEN_HEAP_FRAME(page)) ) { - DPRINTK("gnttab_transfer: out-of-range or xen frame %lx\n", + DPRINTK("gnttab_transfer: xen frame %lx\n", (unsigned long)gop.mfn); (void)__put_user(GNTST_bad_page, &uop[i].status); continue; -- 2.30.2